$(function() {
  $.initPage(eContracExport.load.start);
});

var eContracExport = new BaseFrame();

eContracExport.addBlock('list');

//load module
eContracExport.load.addStart(function() {
  $.pageStart(_eLancoSettings);
  eContracExport.load.runTask();
  eContracExport.event.runTask();
});

eContracExport.load.addBind('createTitle', function() {
  var currentPage = $.getCurrentPage(_eLancoSettings.pageList);
  $('title').text(currentPage.title);
});

eContracExport.load.addBind('createNav', function() {
  var navList = $.getUserAuthorityList(_user.roleList, _eLancoSettings.authorityList, _eLancoSettings.pageList);
  $('#logout').on('click', $.logoff);
  $('#block-nav').createNavList(navList).removeClass('dn');
});

//event module
eContracExport.event.addBind('operation', function() {
  $('#export-btn').on('click', function(event) {
    if (_.isEmpty(_user.department)){
      console.log(_user.department);
      $.getExportList();
    } else {
      console.log(_user.department.name.toLowerCase());
      if (_user.department.name.toLowerCase() == 'hr'){
        var params = {requestType: 2};
        $.getExportList(params);
      } else {
        $.getExportList();
      }        
    }    
    return false;
  })
});
//form module

//save module

//verify module

//message module

//data module